package org.demo.jwt.biz;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author liangcai_zhu
 * @Description TODO
 * @Date 2020/7/7 9:33
 */
@Data
@Accessors(chain = true)
public class CommonResult {
  private Object data;
  private int code=1_100_000_0;
  private int code2=1100000;
  private String message;
  private String verifySecure;

  public CommonResult(Object data, int code, String message) {
    this.data = data;
    this.code = code;
    this.message = message;
  }

  public static CommonResult success(String token) {

    return new CommonResult(token,200,"操作成功");
  }

  public static CommonResult failed(String message) {
    return new CommonResult(message,400,"操作失败");
  }

  public static CommonResult success(PayloadDto payloadDto) {
    return new CommonResult(payloadDto,200,"操作成功");
  }

}
